package com.zwb.boot.common.utils;

/**
 * @author 头发又黑又长
 * @Date 2022/7/22 10:11
 * @email zwb15083976291@163.com
 */
/*
 * 基于 ThreadLocal 封装的工具类，用户保存和获取 登录用户id
 * */
public class BaseContext {
    private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();
    public static void setCurrentId(Long o) {
        threadLocal.set(o);
    }
    public static Long getCurrentId() {
        return threadLocal.get();
    }
    public static void removeCurrentId() {
        threadLocal.remove();
    }

}
